<!--
 * @Author: 邱雪
 * @Date: 2022-01-10 10:10:43
 * @LastEditTime: 2022-06-20 10:21:22
 * @LastEditors: 代琪 1529992814@qq.com
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \test\src\components\login\login-detail-ifra.vue-右上角登录按钮的iframe

-->
<template>

    <div id="login-detail-ifra" :isPopup="isPopup">
    <div class="close-btn loginBtnClose" v-show="isPopup === 'true'" @click="handleClose"
      ><span class="x-close-btn"> x </span></div
    >
    <iframe
      id="loginPreBtnIframe"
      :src="iframeSrc"
      width="345"
      height="351"
      frameBorder="0"
    ></iframe>
  </div>

</template>

<script>
  // import "../../../static/modelOneData/vPortalData.js";
  import emitter from '../../utils/emitter';

  export default {
    name: 'LoginDetailIfra',
    props: {
      isPopup: {
        type: String,
        default: 'true',
      },
    },
    data() {
      return {
        // ctxPath: "/seeyon",
        isLoginPreBtn: null,
        myDataObj: {},
        loginboxbuttonbgc_value: '',
        loginboxbottombgc_value: '',
        loginboxmainbgc_value: '',
        rowList: '',
      };
    },
    computed: {
      // rowList() {},
      // loginboxbuttonbgc_value() {
      //   if (this.isLoginPreBtn) {
      //     this.myDataObj = this.isLoginPreBtn;
      //     return encodeURIComponent(this.myDataObj.loginboxbuttonbgc);
      //   }
      // },
      // loginboxbottombgc_value() {
      //   if (this.isLoginPreBtn) {
      //     this.myDataObj = this.isLoginPreBtn;
      //     return encodeURIComponent(this.myDataObj.loginboxbottombgc);
      //   }
      // },
      // loginboxmainbgc_value() {
      //   if (this.isLoginPreBtn) {
      //     this.myDataObj = this.isLoginPreBtn;
      //     return encodeURIComponent(this.myDataObj.loginboxmainbgc);
      //   }
      // },
      iframeSrc() {
        // console.log(this.loginboxbuttonbgc_value,this.loginboxbottombgc_value,this.loginboxmainbgc_value)
        // todo: 需要更新登录url
        let tempSrc =
          urlPreStr +
          '/main.do?method=index&&loginFrom=loginPortal&topValue=21&rowList=' +
          this.rowList +
          '&btnbgc=' +
          this.loginboxbuttonbgc_value +
          '&btombgc=' +
          this.loginboxbottombgc_value +
          '&bgc=' +
          this.loginboxmainbgc_value;
        return tempSrc;
      },
    },
    mounted() {

    },
    created() {
      if (vPortal.themeHotspots['loginPreBtn']) {
        this.myDataObj = vPortal.themeHotspots['loginPreBtn'];
        this.loginboxbuttonbgc_value = encodeURIComponent(this.myDataObj.loginboxbuttonbgc);
        this.loginboxbottombgc_value = encodeURIComponent(this.myDataObj.loginboxbottombgc);
        this.loginboxmainbgc_value = encodeURIComponent(this.myDataObj.loginboxmainbgc);
        this.getRowList();
      }
    },
    methods: {
      handleClose() {
        emitter.publish('close');
      },
      getRowList() {
        let temp = '';
        if (this.myDataObj) {
          if (this.myDataObj.showQrCode == '1') {
            temp = 'qrCode';
          }
          if (this.myDataObj.showProductInfo == '1') {
            temp = temp ? `${temp},productInfo` : 'productInfo';
          }
        }
        this.rowList = temp;
      },
    },
  };
</script>

<style scoped>
  #login-detail-ifra {
    position: relative;
    width: auto;
    height: auto;
    /* border: 1px solid #d0dae1; */
    box-shadow: 0 1px 10px 1px rgb(0 0 0 / 5%);
    z-index: 999;
  }

  .x-close-btn {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 61;
    width: 20px;
    height: 20px;
    margin: 5px 5px 0;
    font-size: 14px;
    line-height: 20px;
    color: white;
    text-align: center;
    cursor: pointer;
    background: #c3ccd9;
    border-radius: 100%;
  }
</style>
